package com.video.main_video.dao.enums;

import java.util.Objects;

//卡密软件状态
public enum Status {
    
    ACTIVE("激活",1),
    INACTIVE("失效",2),
    ;
    private String name;
    private int code;
    
    private Status(String name,int code){
        this.name=name;
        this.code=code;
    }


    // 通过code获取名称
    public static String formName(int code) {
        for (Status c : Status.values()) {
            if (c.getCode() == code) {
                return c.name;
            }
        }
        return null;
    }

    // 通过名称获取code
    public static Integer formCode(Class name) {
        for (Status c : Status.values()) {
            if (Objects.equals(c.getName(), name)) {
                return c.code;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
